package cn.miao.client;

import cn.miao.hrm.domain.Login;
import cn.miao.hrm.dto.LoginAgencyDto;
import cn.miao.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @program: springcloud-hrm
 * @description:
 * @author: MiaoWei
 * @create: 2021-11-22 21:33
 **/
@Slf4j
@Component
public class LoginFeginClientFallback implements FallbackFactory<LoginFeginClient> {
    @Override
    public LoginFeginClient create(Throwable throwable) {
        return new LoginFeginClient() {

            @Override
            public AjaxResult saveLoginAndRole(LoginAgencyDto login) {
                log.error("保存机构入驻操作失败,失败原因:{}", throwable.getMessage());
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false);

            }

            @Override
            public AjaxResult save(Login login) {
                log.error("保存login失败,失败原因:{}", throwable.getMessage());
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false);
            }
        };
    }
}
